import React from 'react'
import { Row, Col } from 'antd';
import style from './index.module.scss'


export const list = (date = [], newObj = {}) => {

    const dateList = date.map(item => {

        let newDateList = <></>

        for (const key in newObj) {
            if (item.key === key) {
                newDateList = <Col className={`${style.ColItem} ${style.ColItemKey}`} span={16}>{newObj[key]}</Col>
            }
            if (!item.key || item.key == ' ') {
                newDateList = <Col className={`${style.ColItem} ${style.ColItemKey}`} span={16}></Col>
            }
        }

        return (
            <Row className={style.ColList} key={item.id}>
                <Col className={style.ColItem} span={8}>{item.name}</Col>
                {newDateList}
            </Row>
        )
    })


    return dateList
}


